<table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr>
		<td><h1>日报报表</h1></td>
		<td class="actions">
			<table summary="" cellpadding="0" cellspacing="0" border="0" align="right">
				<tr>
					<td <?php echo $this->zaction ?>><a href="<?php echo '?app='.APP.'&mod=summary&type=z'; ?>" class="view">总计</a></td>
					<td <?php echo $this->maction ?>><a href="<?php echo '?app='.APP.'&mod=mingxi&type=m'; ?>" class="view">明细</a></td>
                    <td <?php echo $this->kaction ?>><a href="<?php echo '?app='.APP.'&mod=kehu&type=k'; ?>" class="view">按客户查询</a></td>
					<td <?php echo $this->yaction ?>><a href="<?php echo '?app='.APP.'&mod=yuangong&type=y'; ?>"class="view">按员工查询</a></td>
                    <td <?php echo $this->haction ?>><a href="<?php echo '?app='.APP.'&mod=huafei&type=h'; ?>"class="view">客户费用汇总</a></td>
				</tr>
			</table>
		</td>
	</tr>
</table>

<?php if($this->type=='z'): ?>

<div class="search">
    <form id='search' post="get">
        <span>
         开始时间：<input type="text"  style="width:100px;" id="start_date" name="start_date" value="<?=$this->start_date?>" readonly="1" onclick="new Calendar(2011,2018).show(this)"  />
	      </span>
         <span>
         结束时间：<input type="text" style="width:100px;" id="end_date" name="end_date"  value="<?=$this->end_date?>" readonly="1" onclick="new Calendar(2011,2018).show(this)"  />
		</span>
        <span><input type="submit" value="搜索" /><?php echo showhide(array('app'=>APP,'mod'=>'summary','type'=>'z')); ?></span>
    </form>
</div>
<div class="line_1"></div>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table2">
       <tr>
            <th class="th0" rel="loan_id">编号</th>
            <th class="th0" rel="nickname">职员姓名</th>
      		<th class="th0" rel="nickname">总计</th>
            <th class="th0"></th>
       </tr>
       <?php $loopindex=0;foreach((array)$this->result as $dkey=>$daily): ?> 
         <tr>
         	<td><?php echo ($loopindex+1); ?></td>
            <td><?php echo $dkey; ?></td>
            <td><?php echo $daily['total']; ?></td>
            <td>
            	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table1">
            	<?php foreach((array)$daily as $rkey=>$ritem): ?> 
                	<?php
                    	if($rkey=='total') continue;
                    ?>
                	<tr>
                    	<th class="th0" >申请时间</th>
            			<th class="th0" >报销金额</th>
                        
                    </tr>
            		<tr>
                    	<td class="th0"><?php echo $ritem['dateline']; ?></td>
                        <td class="th0"><?php echo $ritem['total']; ?></td>
                       
                    </tr>
            	<?php endforeach; ?>
                </table>
            </td>
         </tr>
       <?php $loopindex++; endforeach; ?>
</table>




<?php elseif($this->type=='m'): ?>



<div class="search">
    <form id='search' post="get">
        <span>
         开始时间：<input type="text"  style="width:100px;" id="start_date" name="start_date" value="<?=$this->start_date?>" readonly="1" onclick="new Calendar(2011,2018).show(this)"  />
	      </span>
         <span>
         结束时间：<input type="text" style="width:100px;" id="end_date" name="end_date"  value="<?=$this->end_date?>" readonly="1" onclick="new Calendar(2011,2018).show(this)"  />
		</span>
        <span><input type="submit" value="搜索" /><?php echo showhide(array('app'=>APP,'mod'=>'mingxi','type'=>'m')); ?></span>
    </form>
</div>
<div class="line_1"></div>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table2">
       <tr>
            <th class="th0" rel="loan_id">编号</th>
            <th class="th0" rel="nickname">职员姓名</th>
      
            <th class="th0"></th>
       </tr>
       <?php $loopindex=0;foreach((array)$this->result as $dkey=>$daily): ?> 
         <tr>
         	<td><?php echo ($loopindex+1); ?></td>
            <td><?php echo $dkey; ?></td>
            <!--<td><?php echo $daily['total']; ?></td>-->
            <td>
            	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table1">
            	<?php foreach((array)$daily as $rkey=>$ritem): ?> 
                	<?php
                    	if($rkey=='total') continue;
                    ?>
                	<tr>
                    	<th class="th0" >详细费用</th>
                    	<th class="th0" >申请时间</th>
            			<th class="th0" >总计</th>
                        
                    </tr>
            		<tr>
                    	 <td class="th0" style="vertical-align:top; margin-top:0px; padding-top:0px;">
                            <table width="100%" cellpadding="0" cellspacing="0" border="0" class="table1">
                                <?php foreach((array)$ritem['items'] as $okey=>$oitem): ?> 
                                    <tr>
                                        <?php foreach((array)$oitem as $ookey=>$ooitem): ?> 
                                            <td class="smallTd"><?php echo  $this->details[$ookey]; ?></td>
                                        <?php endforeach; ?>
                                      </tr>
                                      <tr>
                                        <?php foreach((array)$oitem as $ookey=>$ooitem): ?> 
                                            <td><?php echo $ooitem; ?></td>
                                        <?php endforeach; ?>
                                     </tr>
                                <?php endforeach; ?>
                             </table>
                        </td>
                    	<td class="th0"><?php echo $ritem['dateline']; ?></td>
                        <td class="th0"><?php echo $ritem['total']; ?></td>
                       
                    </tr>
            	<?php endforeach; ?>
                </table>
            </td>
         </tr>
       <?php $loopindex++; endforeach; ?>
</table>



<?php elseif($this->type=='k'): ?>

<script>
$(function(){
	$('#start_date').val(INPUT_POST.start_date);
	$('#end_date').val(INPUT_POST.end_date);
	
	// autocomplete
	$('#searchUser').autocomplete('?app=<?=APP?>&mod=post&opt=GetCustomer',{
		multiple:false,
		width:150,
		multipleSepartator:'',
		dataType:'json',
		minChars:0,
		parse: function(data) {
			var rows = [];
			for (var i=0; i<data.length ;i++ )
			{
				rows[rows.length] = {
					data: data[i].customer_name,
					value: data[i].customer_name,
					result:data[i].customer_name
				};
			}
			return rows;
		},
		formatItem: function(row,i,n) {
			return row;
		},
		formatResult: function(row,i,n) {
			return row;
		},
		formatMatch: function(row,i,max) {
			return row;
		}
	});
});
</script>

<div class="search">
    <form id='search'>
        <span>客户：
            <input type="text" name="searchUser" id="searchUser" rel="searchUser"  value="<?=$this->customer?>" />
        </span>
		 <span>
         开始时间：<input type="text"  style="width:100px;" id="start_date" name="start_date" value="<?=$this->start_date?>" readonly="1" onclick="new Calendar(2011,2018).show(this)"  />
	      </span>
         <span>
         结束时间：<input type="text" style="width:100px;" id="end_date" name="end_date"  value="<?=$this->end_date?>" readonly="1" onclick="new Calendar(2011,2018).show(this)"  />
		</span>
        <span><input type="submit" value="搜索" /><?php echo showhide(array('app'=>APP,'mod'=>'kehu','type'=>'k')); ?></span>
    </form>
</div>
<div class="line_1"></div>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table2">
       <tr>
            <th class="th0" rel="loan_id">编号</th>
            <th class="th0" rel="nickname">客户</th>
            <th class="th0" rel="nickname">工作详情</th>
       </tr>
       <?php $loopindex=0;foreach((array)$this->result as $dkey=>$daily): ?> 
         <tr>
         	<td><?php echo ($loopindex+1); ?></td>
            <td><?php echo $dkey ?></td>
            <td>
            	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table1">
            	<?php foreach((array)$daily as $rkey=>$ritem): ?> 
                	<tr>
                    	<td><?php echo $rkey ?></th>
            			<td>
                        	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table2">
                                  <tr>
                                        <th class="th0" rel="loan_id">员工</th>
                                        <th class="th0" rel="nickname">项目阶段</th>
                                        <th class="th0" rel="nickname">工作内容</th>
										<th class="th0" rel="nickname">工作结果</th>
                                   </tr>
                                   <?php foreach((array)$ritem as $rrkey=>$rritem): ?> 
                                        <tr>
                                             <td><?php echo $rritem['username'] ?></th>
                                             <td><?php echo $rritem['project_phase'] ?></th>
                                             <td><?php echo $rritem['work_mark'] ?></th>
                    						 <td><?php echo $rritem['work_result'] ?></th>
                                        </tr>
                                    <?php endforeach; ?>
                                   
                             </table>
                        </th>
                    </tr>
            	<?php endforeach; ?>
                </table>
            </td>
         </tr>
       <?php $loopindex++; endforeach; ?>
</table>



<?php elseif($this->type=='y'): ?>


<script>
$(function(){
	$('#start_date').val(INPUT_POST.start_date);
	$('#end_date').val(INPUT_POST.end_date);
	
	// autocomplete
	$('#searchUser').autocomplete('?app=<?=APP?>&mod=post&opt=GetUser',{
		multiple:false,
		width:150,
		multipleSepartator:'',
		dataType:'json',
		minChars:0,
		parse: function(data) {
			var rows = [];
			for (var i=0; i<data.length ;i++ )
			{
				rows[rows.length] = {
					data: data[i].username,
					value: data[i].username,
					result:data[i].username
				};
			}
			return rows;
		},
		formatItem: function(row,i,n) {
			return row;
		},
		formatResult: function(row,i,n) {
			return row;
		},
		formatMatch: function(row,i,max) {
			return row;
		}
	});
});
</script>
<div class="search">
    <form id='search'>
         <span>员工：
            <input type="text" name="searchUser" id="searchUser" rel="searchUser"  value="<?=$this->sel_UName?>" />
        </span>
		 <span>
         开始时间：<input type="text"  style="width:100px;" id="start_date" name="start_date" value="<?=$this->start_date?>" readonly="1" onclick="new Calendar(2011,2018).show(this)"  />
	      </span>
         <span>
         结束时间：<input type="text" style="width:100px;" id="end_date" name="end_date"  value="<?=$this->end_date?>" readonly="1" onclick="new Calendar(2011,2018).show(this)"  />
		</span>
        <span><input type="submit" value="搜索" /><?php echo showhide(array('app'=>APP,'mod'=>'yuangong','type'=>'y')); ?></span>
    </form>
</div>
<div class="line_1"></div>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table2">
<tr>
            <th class="th0" rel="loan_id">编号</th>
            <th class="th0" rel="nickname">员工</th>
            <th class="th0" rel="nickname">工作详情</th>
       </tr>
       <?php $loopindex=0;foreach((array)$this->result as $dkey=>$daily): ?> 
         <tr>
         	<td><?php echo ($loopindex+1); ?></td>
            <td><?php echo $dkey ?></td>
            <td>
            	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table1">
            	<?php foreach((array)$daily as $rkey=>$ritem): ?> 
                	<tr>
                    	<td><?php echo $rkey ?></th>
            			<td>
                        	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table2">
                                  <tr>
                                        <th class="th0" rel="loan_id">客户</th>
                                        <th class="th0" rel="nickname">拜访次数</th>
                                        <th class="th0" rel="nickname">费用</th>
                                        <th class="th0" rel="nickname"></th>
                                        
                                   </tr>
                                   <?php foreach((array)$ritem as $rrkey=>$rritem): ?> 
                                        <tr>
                                             <td><?php echo $rrkey ?></td>
                                             <td><?php echo $rritem['times'] ?></td>
                                             <td><?php echo $rritem['total'] ?></td>
                    						 <td>
                                             	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table2">
                                                      <tr>
                                                            <th class="th0" >工作阶段</th>
                                                            <th class="th0" >工作内容</th>
                                                            <th class="th0" >费用</th>
                                                       </tr>
                                                       <?php foreach((array)$rritem['items'] as $rrrkey=>$rrritem): ?> 
                                                            <tr>
                                                                 <td><?php echo $rrritem['project_phase'] ?></td>
                                                                 <td><?php echo $rrritem['work_result'] ?></td>
                                                                 <td><?php echo $rrritem['thistotal'] ?></td>
                                                            </tr>
                                                        <?php endforeach; ?>
                                                       
                                                 </table>
                                             
                                             </td>
                                        </tr>
                                    <?php endforeach; ?>
                                   
                             </table>
                        </th>
                    </tr>
            	<?php endforeach; ?>
                </table>
            </td>
         </tr>
       <?php $loopindex++; endforeach; ?>
</table>

<?php elseif($this->type=='h'): ?>


<script>
$(function(){
	$('#start_date').val(INPUT_POST.start_date);
	$('#end_date').val(INPUT_POST.end_date);
	
	// autocomplete
	$('#searchUser').autocomplete('?app=<?=APP?>&mod=post&opt=GetCustomer',{
		multiple:false,
		width:150,
		multipleSepartator:'',
		dataType:'json',
		minChars:0,
		parse: function(data) {
			var rows = [];
			for (var i=0; i<data.length ;i++ )
			{
				rows[rows.length] = {
					data: data[i].customer_name,
					value: data[i].customer_name,
					result:data[i].customer_name
				};
			}
			return rows;
		},
		formatItem: function(row,i,n) {
			return row;
		},
		formatResult: function(row,i,n) {
			return row;
		},
		formatMatch: function(row,i,max) {
			return row;
		}
	});
});
</script>
<div class="search">
    <form id='search'>
         <span>客户：
            <input type="text" name="searchUser" id="searchUser" rel="searchUser"  value="<?=$this->customer?>" />
        </span>
		 <span>
         开始时间：<input type="text"  style="width:100px;" id="start_date" name="start_date" value="<?=$this->start_date?>" readonly="1" onclick="new Calendar(2011,2018).show(this)"  />
	      </span>
         <span>
         结束时间：<input type="text" style="width:100px;" id="end_date" name="end_date"  value="<?=$this->end_date?>" readonly="1" onclick="new Calendar(2011,2018).show(this)"  />
		</span>
        <span><input type="submit" value="搜索" /><?php echo showhide(array('app'=>APP,'mod'=>'huafei','type'=>'h')); ?></span>
    </form>
</div>
<div class="line_1"></div>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table2">
<tr>
            <th class="th0">编号</th>
            <th class="th0">客户</th>
            <th class="th0">合计费用</th>
            <th class="th0">工作详情</th>
       </tr>
       <?php $loopindex=0;foreach((array)$this->result as $dkey=>$daily): ?> 
         <tr>
         	<td><?php echo ($loopindex+1); ?></td>
            <td><?php echo $dkey ?></td>
            <td><?php echo $daily['total'] ?></td>
            <td>
            				<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table2">
                                  <tr>
                                        <th class="th0" rel="loan_id">客户</th>
                                        <th class="th0" rel="nickname">费用</th>
                                   </tr>
                                   <?php foreach((array)$daily['items'] as $rrkey=>$rritem): ?> 
                                        <tr>
                                             <td><?php echo $rrkey ?></td>
                                             <td><?php echo $rritem ?></td>
                                        </tr>
                                    <?php endforeach; ?>
                                   
                             </table>
            </td>
         </tr>
       <?php $loopindex++; endforeach; ?>
</table>
<?php endif; ?>





